home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ozsi 10
/
Ozsi_10_1998_Tide_Side_C.d64
/
program merge
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
981b
|
49 lines
90 poke53280,1:poke53281,1:print"[147]"
95 printspc(13)"hills 64 group"
100 printspc(13)"program merger"
110 dim a$(2),b$(2),c$(2),n(2)
120 open 15,8,15
130 input"program 1";x$
140 open1,8,2,x$+",p,r"
150 input#15,e,e$,e1,e2
160 if e then print e$:close15:end
170 get#1,a$,a$:j=1:gosub420
180 input"program 2 (or 'n')";x$
190 if x$="n" then n(2)=1e9:goto240
200 open2,8,3,x$+",p,r"
210 input#15,e,e$,e1,e2
220 if e then print e$:close15:end
230 get#2,a$,a$:j=2:gosub420
240 input"new file";x$
250 open8,8,8,"0:"+x$+",p,w"
260 input#15,e,e$,e1,e2
270 if e then print e$:close 15:end
280 print#8,chr$(1);chr$(4);
290 rem compare the lines here
300 x=2
310 ifn(1)<n(2)thenx=1
320 n=n(x):ifn>1e8then380
330 print#8,chr$(1);chr$(1);a$(x);b$(x);c$(x);chr$(0);
340 forj=1to2
350 if n(j)=n then gosub420
360 next j
370 goto300
380 print#8,chr$(0);chr$(0);
390 close1:close2:close8:close15
400 end
410 rem read line of basic
420 get#j,a$,b$
430 ifa$=""andb$=""then540
440 get#j,a$(j),b$(j)
450 ifa$(j)=""thena$(j)=chr$(0)
460 ifb$(j)=""thenb$(j)=chr$(0)
470 n(j)=asc(a$(j))+asc(b$(j))*256
480 c$(j)=""
490 get#j,a$
500 ifa$=""then550
510 c$(j)=c$(j)+a$
520 ifst=0andlen(c$(j))<254then490
530 print"problem file ";j
540 n(j)=1e9
550 return